<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>用户列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/themes/admin/css/font.css">
    <link rel="stylesheet" href="/themes/admin/css/xadmin.css">
    <link rel="stylesheet" href="/themes/admin/css/common.css">
    <script src="/themes/admin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/themes/admin/js/xadmin.js"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="x-nav">
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>订单ID</th>
                            <th>商品</th>
                            <th>价格</th>
                            <th>支付状态</th>
                            <th>支付方式</th>
                            <th>下单时间</th>
                            <th>管理</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name="orderList" id="vo"}
                        <tr>
                            <td>{$vo.id}</td>
                            <td>{$vo.goods_title}</td>
                            <td>{$vo.price}</td>
                            <td>{eq name="$vo.status" value="1"}<span style="color: #5FB878">已支付</span>{else/}<span style="color: #FD482C">未支付</span>{/eq}</td>
                            <td>{$vo.pay_type}</td>
                            <td>{$vo.create_time}</td>
                            <td>
                                <button onclick="delOrder('{$vo.id}',this)" class="layui-btn layui-btn-danger">删除</button>
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                    {$orderList|raw}
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    layui.use(['form'], function(){
        var  form = layui.form;
    });

    //删除订单
    function delOrder(orderId,obj) {
        layer.msg('确定删除该订单？', {
            time: 0
            ,btn: ['删除', '取消']
            ,yes: function(index){
                $.ajax({
                    type:"POST",
                    data:{
                        id:orderId
                    },
                    url:"/admin/shop/delOrder",
                    success:function (e) {
                        if (e.code == 1){
                            layer.msg(e.msg,{icon:1})
                            $(obj).parents("tr").remove();
                        }else {
                            layer.msg(e.msg,{icon:2})
                        }
                    }
                })
            }
        });
    }

</script>
</html>